package cn.com.system.controller;

import cn.com.system.pojo.Accounts;
import cn.com.system.pojo.Clue;
import cn.com.system.service.ClueService;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;


import javax.annotation.Resource;
import java.util.List;

/**
 * (Clue)表控制层
 *
 * @author makejava
 * @since 2021-04-06 20:06:41
 */
@Controller
@RequestMapping("clue")
public class ClueController extends BaseController{
    /**
     * 服务对象
     */
    @Resource
    private ClueService clueService;
    @RequestMapping("/clue1.do")
    public String Clue1(Model model,Clue clue){
        List<Clue> list = clueService.queryAll(clue);
        model.addAttribute("clueList",list);
        return "clue1";
    }
    @RequestMapping("/clue2.do")
    public String Clue2(Model model,Clue clue){
        List<Clue> list = clueService.queryAll(clue);
        model.addAttribute("clueList",list);
        return "clue2";
    }
    @RequestMapping("/clue3.do")
    public String Clue3(Model model,Clue clue){
        List<Clue> list = clueService.queryAll(clue);
        model.addAttribute("clueList",list);
        return "clue3";
    }
    @RequestMapping("/clueAdd")
    public String ClueAdd(){
        return "add-clue1";
    }

    @RequestMapping("/clueDeleteId1")
    public String ClueDeleteId1(@RequestParam(value="c_id",required = false) Integer c_id){
        System.out.println(c_id);
        int num = clueService.deleteClueById(c_id);
        return "redirect:/clue/clue1.do";
    }

    @RequestMapping("/updateClue1.do")
    public String updateClue1(Clue clue){
        System.out.println(clue);
        int num=clueService.updateClue1(clue);
        if (num>0){
            return "redirect:/clue/clue1.do";
        }else {
            return "index";
        }
    }

    @RequestMapping("/updateClue2.do")
    public String updateClue2(Clue clue){
        System.out.println(clue);
        int num=clueService.updateClue2(clue);
        if (num>0){
            return "redirect:/clue/clue2.do";
        }else {
            return "index";
        }
    }
    @RequestMapping("/updateClue3.do")
    public String updateClue3(Clue clue){
        System.out.println(clue);
        int num=clueService.updateClue3(clue);
        if (num>0){
            return "redirect:/clue/clue3.do";
        }else {
            return "index";
        }
    }

    @RequestMapping("/addClue1.do")
    public String addClue1(Clue clue){
        System.out.println(clue);
        clueService.addClue1(clue);

            return "redirect:/clue/clue1.do";

    }
}